/* Layout */
import Layout from '../views/layout/Layout';
// import Vue from 'vue';
// import VueI18n from 'vue-i18n'; // set VueI18n
// utils
import { mapToArray } from '@/utils/base';

const _import = require(`./_import_${process.env.NODE_ENV}`);

// 财务管理
export const finaRechargeType = {
  rechargeLogs: 'recharge-logs', /* 充值记录 */
  auto: 'auto', /* 三方自动入款 */
  manual: 'manual', /* 转账入款 */

  autoBatchRepair: 'auto-batch-repair', /* 批量补单 */
  autoRepair: 'auto-repair', /* 单个补单 */

  repairAudit: 'repair-audit', /* 充值补单审核 */
  repairAuditBatch: 'repair-audit-batch', /* 批量审核 */
  repairAuditSingle: 'repair-audit-single', /* 单个审核 */

  exceptionRecharge: 'exception-recharge', /* 异常充值处理 */
  exceptionRechargeDeal: 'exception-recharge-deal', /* 单个处理 */

  rechargeAmountSet: 'recharge-amount-set', /* 充值金额设置 */
  rechargeAmountConfig: 'recharge-amount-config', /* 编辑 */
  rechargeAmountMobile: 'recharge-amount-mobile-config', /* 快捷金额设置 */
  rechargeLimitBank: 'recharge-limit-bank', /* 设置银行卡限额 */

  //
  manualBatchRepair: 'manual-batch-repair', /* 人工-批量补单 */
  manualRepair: 'manual-repair', // TODO 转账充值-补单

  rechargExceptiont: 'recharg-exceptiont', // 充值异常记录
};

// 提现管理
export const finaWithdrawType = {
  normalWithdraw: 'normal-withdraw', /* 正常提现 */
  auto: 'auto', /* 三方自动出款 */
  manual: 'manual', /* 人工出款 */
  withdrawSeperate: 'withdraw-Seperate', /* 提现分单 */
  autoThree: 'auto-three', /* 三方手动出款 */
  autoRecord: 'auto-record', /* 出款记录 */

  exceptionWithdraw: 'exception-withdraw', /* 异常提现处理 */
  exceptionAgree: 'exception-agree', /* 通过 */
  exceptionRefuse: 'exception-refuse', /* 拒绝 */

  withdrawOperationAudit: 'withdraw-operation-audit', /* 提现操作审核 */
  withdrawOperationAuditBtn: 'withdraw-operation-audit-btn', /* 审核 */

  withdrawConfig: 'withdraw-config', /* 提现相关设置 */
  withdrawConfigBtn: 'withdraw-config-save', /* 保存 */

  withdrawRiskConfig: 'withdraw-risk-config', /* 提现风控设置 */
  withdrawRiskConfigBtn: 'withdraw-risk-config-btn', /* 保存/重置 */

  withdrawSingle: 'withdraw-single', /* 提现分单设置 */
  withdrawSingleMain: 'withdraw-single-main', /* 分单功能设置 */
  withdrawSingleAccount: 'withdraw-single-account', /* 分单账户设置 */
  withdrawSingleAuto: 'withdraw-single-auto', /* 自动出款设置 */

  //
  autoForceSuccess: 'auto-force-success', /* 成功 */
  autoReturn: 'auto-return', /* 退回 */
  manualAgree: 'manual-agree', /* 人工-通过 */
  manualRefuse: 'manual-refuse', /* 人工-拒绝 */
  manualReturn: 'manual-return', /* 人工-退回 */
  withdrawMainAdd: 'withdraw-main-add', /* 添加 */
  withdrawMainView: 'withdraw-main-view', /* 查看 */
  withdrawMainDel: 'withdraw-main-del', /* 删除 */
  withdrawMainEdit: 'withdraw-main-edit', /* 修改 */
  withdrawAccountAdd: 'withdraw-account-add', /* 批量添加分单账户 */
  withdrawAccountSet: 'withdraw-account-set', /* 设置分单账户 */
  withdrawAccountOpen: 'withdraw-account-open', /* 开启 */
  withdrawAccountClose: 'withdraw-account-close', /* 关闭 */
  autoThrough: 'auto-through', /* 通过 */
  autoRefused: 'auto-refused', /* 拒绝 */
  batchRecover: 'batch-recover', /* 批量回收 */
  batchSeperate: 'batch-seperate', /* 批量分单 */
  withdrawDelAll: 'withdraw-del-all',
  withdrawSetting: 'withdraw-setting',
  withdrawDel: 'withdraw-del',
  withdrawAutoAdd: 'withdraw-auto-add',
  withdrawAutoDel: 'withdraw-auto-del',
  withdrawAutoEdit: 'withdraw-auto-edit',
  autoThreeReturn: 'auto-three-return',
  autoThreeSuccess: 'auto-three-success',
  autoThreeThrough: 'auto-three-through',
  autoThreeRefused: 'auto-three-refused',
  autoRecordExport: 'auto-record-export',
};

// 转账管理
export const finaTransferType = {
  records: 'records', /* 转账记录 */

  exceptionRecords: 'exception-records', /* 异常转账记录 */
  batchDeal: 'batch-deal', /* 批量处理 */
  singleDeal: 'single-deal', /* 单个处理 */
};

// 资金调整审核
export const finaAccoChangeType = {
  applyTab: 'apply-tab', /* 资金调整申请 */

  auditTab: 'audit-tab', /* 资金调整审核 */
  firstAudit: 'first-audit', /* 一审 */
  secondAudit: 'second-audit', /* 二审 */
};

// 用户银行卡记录
export const finaUserBankCardRecordType = {
};

// Vue.use(VueI18n);
// const i18n = new VueI18n({
//   locale: sessionStorage.getItem('lang'),
//   messages: {
//     CN: require('../lang/zh'), // 中文语言包
//     EN: require('../lang/en'), // 英文语言包
//   },
// });

export default [
  {
    path: '/finance',
    component: Layout,
    // meta: { roles: [] }, // you can set roles in root nav
    redirect: 'noredirect',
    name: 'finance',
    meta: {
      // title: vue.$t('language.finance.title'),
      title: '财务管理',
      englishTitle: 'Finance MGMT',
      // title: Vue.$i18n.locale == 'zh' ? '财务管理' : 'Finance MGMT',
      icon: 'money',
      roles: [],
    },
    children: [
      {
        path: 'finance-recharge',
        name: 'finance-recharge',
        component: _import('finance/recharge/index'),
        meta: {
          // title: Vue.$t('language.finance.recharge.rechargeManage'),
          title: '充值管理',
          englishTitle: 'Deposit MGMT',
          // notLog: true,
          noCache: true,
          roles: mapToArray(finaRechargeType),
        },
      },
      {
        path: 'finance-withdraw',
        name: 'finance-withdraw',
        component: _import('finance/withdraw/index'),
        // beforeEnter(to, from, next) => {
        //   // ...
        // },
        meta: {
          // title: Vue.$t('language.finance.withdrawal.withdrawalManage'),
          // notLog: true,
          title: '提现管理',
          englishTitle: 'Withdraw MGMT',
          noCache: true,
          roles: mapToArray(finaWithdrawType),
        },
      },
      {
        path: 'finance-transfer',
        name: 'finance-transfer',
        component: _import('finance/transfer/index'),
        meta: {
          title: '转账管理',
          notLog: true,
          roles: mapToArray(finaTransferType),
        },
      },
      {
        path: 'finance-account-change-audit',
        name: 'finance-account-change-audit',
        component: _import('finance/adjustment/index'),
        meta: {
          title: '资金调整审核',
          notLog: true,
          roles: mapToArray(finaAccoChangeType),
        },
      },
      {
        path: 'finance-user-bank-card-record',
        name: 'finance-user-bank-card-record',
        component: _import('finance/userBank/logs'),
        meta: {
          title: '用户银行卡记录',
          roles: mapToArray(finaUserBankCardRecordType),
        },
      },
    ],
  },
];
